#
# RED queue
#
#   The scripts used to make the figure in the paper were from a
# simulator that is now several generations old.  These ns-2 scripts
# are a slightly-modified version of scripts from Davide Bergamasco at
# Cisco.
#
source common.tcl

#zhao wei, 2009.10.6
# ns red.tcl minithreshold seed maxthreshold w_q
#set maxthresh [expr $minthresh * 3]
set minthresh [lindex $argv 0]
set seed  [lindex $argv 1]
set maxthresh [lindex $argv 2]
set w_q [lindex $argv 3]

set queuetype RED

puts "minthresh $minthresh maxthresh $maxthresh"
puts "w_q $w_q"
set BuffSize 140

#for the details of RED http://read.cs.ucla.edu/click/elements/RED
Queue/RED set linterm_ 50 
Queue/RED set thresh_ $minthresh
Queue/RED set maxthresh_ $maxthresh
Queue/RED set limit_ $BuffSize 

#Queue/RED set bottom_ $w_q
#Queue/RED set top_ $w_q
Queue/RED set q_weight_ $w_q
#Queue/RED/RIO set q_weight_ $w_q

init $seed $BuffSize
topo
make_traffic
$ns at $SimTime "get_queue; finish"
puts "Running simulation $seed Buff= $BuffSize"
$ns run

